﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cloak.NUnit;
using NUnit.Framework;

namespace Cloak.Time
{
	public class CreateOffsetTimeContext : Behavior
	{
		private DateTime _now;
		private TimeSpan _offset;
		private ITimeContext _baseTimeContext;
		private OffsetTimeContext _offsetTimeContext;

		protected override void Given()
		{
			_now = DateTime.Now;
			_offset = TimeSpan.FromDays(1);

			_baseTimeContext = new ConstantTimeContext(_now);
		}

		protected override void When()
		{
			_offsetTimeContext = new OffsetTimeContext(_baseTimeContext, _offset);
		}

		[Then]
		public void NowIsOffsetFromOriginalValue()
		{
			Assert.That(_offsetTimeContext.Now, Is.EqualTo(_now + _offset));
		}
	}
}